package com.dsteiner.xelavos.client.domain;

import java.util.Date;

import javax.jdo.annotations.Embedded;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.persistence.AttributeOverrides;
import javax.persistence.Enumerated;

import com.dsteiner.widgets.client.ObjectUtil;
import com.dsteiner.widgets.client.domain.ModelObject;
import com.dsteiner.widgets.client.domain.Searchable;
import com.dsteiner.widgets.client.domain.SearchableId;
import com.dsteiner.widgets.client.domain.SearchableRefId;
import com.dsteiner.widgets.client.rpc.SearchRequest;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
@Searchable
public class TrackComments extends ModelObject{

	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
    @SearchableId
    private String id;
	
	@Persistent
	@SearchableRefId
    private String userId;
	
	@Persistent
	@SearchableRefId
	private String objectId;
	
	@Persistent
	private Date registeredDate = new Date();
	
    public TrackComments() {
	}

    public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (!(obj instanceof TrackComments))
			return false;
		TrackComments other = (TrackComments) obj;
		return ObjectUtil.equals(getId(), other.getId());
	}

	@Override
	public String getId() {
		return id;
	}

	@Override
	public void setId(String id) {
		this.id = id;
	}
	
	public String getUserId() {
		return userId;
	}
	public String getObjectId() {
		return objectId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public void setObjectId(String objectId) {
		this.objectId = objectId;
	}

	@Override
	public Date getRegisteredDate() {
		return registeredDate;
	}
	public void setRegisteredDate(Date registeredDate) {
		this.registeredDate = registeredDate;
	}
}